/**
 * 产品信息页面
 */

export const InfoSearchFor = [
  {  label: '品牌', prop: 'assistant_id', type: 'select', multiple: true },
  {  label: '产品编码', prop: 'number', type: 'lazySelect', multiple: true },
  {  label: '产品名称', prop: 'name', type: 'lazySelect', multiple: true },
  {  label: '条码', prop: 'barcode', type: 'lazySelect', multiple: true },
  {  label: '一级类目', prop: 'class_id1', type: 'select_1', multiple: true },
  {  label: '二级类目', prop: 'class_id2', type: 'select_2', multiple: true },
  {  label: '系列', prop: 'xl_id', type: 'select', multiple: true },
  {  label: '物料大类', prop: 'large_category_id', type: 'select', multiple: true },
  {  label: '是否考核', prop: 'is_examine', type: 'select', multiple: false },
  {  label: '是否主推', prop: 'is_master', type: 'select', multiple: false },
  {  label: '是否有产品图', prop: 'is_img', type: 'select' },
]

export const InfoCloums = [
  { label: '条码', prop: 'barcode', width: '140', },
  { label: '规格型号', prop: 'specification', width: '100',},
  { label: '基本单位', prop: 'unit_name', width: '100' },
  { label: '一级类目', prop: 'class_name1', width: '100' },
  { label: '二级类目', prop: 'class_name2', width: '100' },
  { label: '系列', prop: 'xl_name', width: '100' },
  { label: '物料大类', prop: 'large_category_name', width: '100' },
  { label: '箱规', prop: 'box_specs', width: '100' },
  { label: '主推', prop: 'is_master', width: '60', type: 'boolean' },
  { label: '考核', prop: 'is_examine', width: '60', type: 'boolean' },

  { label: '长', prop: 'length', width: '100', type: 'money' },
  { label: '宽', prop: 'width', width: '100', type: 'money' },
  { label: '高', prop: 'height', width: '100', type: 'money' },
  { label: '体积', prop: 'volume', width: '100', type: 'money' },
  { label: '毛重', prop: 'gross_weight', width: '100', type: 'money' },
  { label: '净重', prop: 'net_weight', width: '100', type: 'money' },
]

export const InfoData = []

export const InfoSearchSelect = (data:any, value: any)=>{

  // "assistant_id": "", // 品牌
  // "name": "", // 物料名称
  // "number": "", // 物料编码
  // "barcode": "", // 条码
  // "class_id1": "", // 一级类目
  // "class_id2": "", // 二级类目
  // "xl_id": "", // 系列
  // "large_category_id": "", // 大类
  // "is_master": "", // 是否主推
  // "is_examine": "", // 是否考核

  const { barcode, brand, category, class_one, class_two, name, number, series } = data

  if (value == 'assistant_id' && brand.length) {
    return brand.map((item:any)=>{
      return { value: item.entry_id, label: item.name }
    })
  }
  if ((value == 'name' || value == 'goods_name') && name.length) {
    return name.map((item:any)=>{
      return { value: item.name, label: item.name }
    })
  }
  if ((value == 'number' || value == 'goods_number') && number.length) {
    return number.map((item:any)=>{
      return { value: item.number, label: item.number }
    })
  }
  if (value == 'barcode' && barcode.length) {
    return barcode.map((item:any)=>{
      return { value: item.barcode, label: item.barcode }
    })
  }
  if (value == 'class_id1' && class_one.length) {
    return class_one.map((item:any)=>{
      return { value: item.id, label: item.data_title }
    })
  }
  if (value == 'class_id2' && class_two.length) {
    return class_two.map((item:any)=>{
      return { value: item.id, label: item.data_title }
    })
  }
  if (value == 'xl_id' && series.length) {
    return series.map((item:any)=>{
      return { value: item.id, label: item.data_title }
    })
  }
  if (value == 'large_category_id' && category.length) {
    return category.map((item:any)=>{
      return { value: item.id, label: item.data_title }
    })
  }
  if (value == 'is_master' || value == 'is_examine') {
    return [
      { value: '1', label: '是' },
      { value: '2', label: '否' },
      { value: '0', label: '空' },
    ]
  }
  if (value == 'is_img') {
    return [
      { value: '0', label: '否' },
      { value: '1', label: '是' },
    ]
  }
  return []
}

// 产品价格查询
export const InfoPriceCloums = [
  { label: '条码', prop: 'barcode', width: '140', },
  { label: '规格型号', prop: 'specification', width: '100',},
  { label: '基本单位', prop: 'unit_name', width: '100' },
  { label: '标准零售价', prop: 'retail_price', type: 'money', width: '100' },
  { label: '底价', prop: 'base_price', type: 'money', width: '100' },
  { label: '一级类目', prop: 'class_name1', width: '100' },
  { label: '二级类目', prop: 'class_name2', width: '100' },
  { label: '系列', prop: 'xl_name', width: '100' },
  { label: '物料大类', prop: 'large_category_name', width: '100' },
  { label: '箱规', prop: 'box_specs', width: '100' },
  { label: '主推', prop: 'is_master', width: '60', type: 'boolean' },
  { label: '考核', prop: 'is_examine', width: '60', type: 'boolean' },
  { label: '创建人', prop: 'create_user_name', width: '100' },
  { label: '创建时间', prop: 'created_at', width: '160' },
  { label: '更新人', prop: 'update_user_name', width: '100' },
  { label: '更新时间', prop: 'update_time', width: '160' },
]

/**
 * 产品详情页面
 */

export const DetailSearchFor = [
  {  label: '一级类目',  detailProps: 'class_name1', prop: 'class_id1', type: 'select_1', multiple: false },
  {  label: '二级类目',  detailProps: 'class_name2', prop: 'class_id2', type: 'select_2', multiple: false },
  {  label: '系列',  detailProps: 'xl_name', prop: 'xl_id', type: 'select', multiple: false },
  {  label: '物料大类',  detailProps: 'large_category_name', prop: 'large_category_id', type: 'select', multiple: false },
  {  label: '箱规',  detailProps: 'box_specs', prop: 'box_specs', type: 'input' },
  {  label: '是否考核',  detailProps: 'is_examine_boo', prop: 'is_examine', type: 'switch', multiple: false },
  {  label: '是否主推',  detailProps: 'is_master_boo', prop: 'is_master', type: 'switch', multiple: false },
]

/**
 * 标准价目表
 */
export const StandardPriceSearchFor = [
  {  label: '价格是否有效', prop: 'is_validity', type: 'select', multiple: false },
  {  label: '产品编码', prop: 'goods_number', type: 'lazySelect', multiple: false, selectType: 'number' },
  {  label: '产品名称', prop: 'goods_name', type: 'lazySelect', multiple: false, selectType: 'name' },
]
export const StandardPriceCloums = [
  { disabled: false, label: '品牌', prop: 'brand', width: '80', },
  { disabled: false, label: '产品编码', prop: 'goods_number', width: '160',},
  { disabled: false, label: '产品名称', prop: 'goods_name' },
  { disabled: false, label: '标准零售价', prop: 'retail_price', type: 'money_eye', width: '100' },
  { disabled: false, label: '价格有效期', prop: 'validity', type: '', width: '180' },
  { disabled: false, label: '价格是否有效', prop: 'is_validity', type: 'boolean', width: '120', },
  { disabled: false, label: '创建人', prop: 'create_user_name', width: '100', },
  { disabled: false, label: '创建时间', prop: 'created_at', width: '160', },
  { disabled: false, label: '更新人', prop: 'update_user_name', width: '100' },
  { disabled: false, label: '更新时间', prop: 'updated_at', width: '160' },
]

export const LowPriceCloums = [
  { disabled: false, label: '品牌', prop: 'brand', width: '80', },
  { disabled: false, label: '产品编码', prop: 'goods_number', width: '160',},
  { disabled: false, label: '产品名称', prop: 'goods_name', },
  { disabled: false, label: '底价', prop: 'retail_price', type: 'money_eye', width: '100' },
  { disabled: false, label: '价格有效期', prop: 'validity', type: '', width: '180' },
  { disabled: false, label: '价格是否有效', prop: 'is_validity', type: 'boolean', width: '120', },
  { disabled: false, label: '创建人', prop: 'create_user_name', width: '100', },
  { disabled: false, label: '创建时间', prop: 'created_at', width: '160', },
  { disabled: false, label: '更新人', prop: 'update_user_name', width: '100' },
  { disabled: false, label: '更新时间', prop: 'updated_at', width: '160' },
]


// 导入价目表[模板]
export const ExportStandarXlsx  = 'https://dc-app-oss.oss-cn-zhangjiakou.aliyuncs.com/dms/product_price/%E6%A0%87%E5%87%86%E4%BB%B7%E6%A8%A1%E6%9D%BF.xlsx'
export const ExportLowXlsx  = 'https://dc-app-oss.oss-cn-zhangjiakou.aliyuncs.com/dms/product_price/%E5%BA%95%E4%BB%B7%E6%A8%A1%E6%9D%BF%20.xlsx'
